# Path to your oh-my-zsh installation.
export ZSH=$HOME/oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#ZSH_THEME="robbyrussell"
#ZSH_THEME="bira"
#ZSH_THEME="cloud"
#ZSH_THEME="random"
#ZSH_THEME="pygmalion"
#ZSH_THEME="cloud"
ZSH_THEME="arrow"


setopt hist_ignore_space
# alias nemo=" nemo --no-desktop"
alias cd=" cd"
alias ls=" ls -h"

#autoload -U zsh-newuser-install
#autoload -U compinit
#compinit

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.

plugins=(git adb battery colored-man-pages zsh-autosuggestions zsh-syntax-highlighting)
#plugins=(adb)
#plugins=(battery)
#plugins=(web-search)

# User configuration

# export PATH=$(ruby -rubygems -e "puts Gem.user_dir")/bin:/opt/arm-2014.05/bin:$HOME/bin:/usr/local/bin:/home/corvo/Android/Ndk/android-ndk-r10e:$PATH

# export MANPATH="/usr/local/man:$MANPATH"

source $ZSH/oh-my-zsh.sh

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

export TERM=xterm-256color
#export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"
eval `dircolors ~/config/dircolors`
export LESSOPEN="| /usr/bin/source-highlight-esc.sh %s"
export LESS='-R '
export LD_LIBRARY_PATH=/usr/local/lib

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export SCALA_HOME=/home/share/scala


zmodload zsh/zpty

pty() {
	zpty pty-${UID} ${1+$@}
	if [[ ! -t 1 ]];then
		setopt local_traps
		trap '' INT
	fi
	zpty -r pty-${UID}
	zpty -d pty-${UID}
}

ptyless() {
	pty $@ | less
}


alias update="sudo pacman -Syu"
#alias sleep="i3lock && sudo su root -s /bin/bash -c 'sudo echo "mem" > /sys/power/state'"

alias free="free -h"
alias new-tern="gnome-terminal"
alias rm="rm -vi"
alias seu_wlan="~/bin/SeuConnect.py"
alias you-get="you-get -o ~/Downloads/YouGet"

alias sdcv="sdcv -c"

alias conky_start="sh ~/.conky/conky-startup.sh"
alias aria2_start="aria2c --conf-path=/home/corvo/.aria2/aria2c.conf"
#alias zsh="source ~/.zshrc"

# For Android 
export EXPERIMENTAL_USE_JAVA8=true

#FOR Git
alias gl="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
"
alias gg="git-dag"
alias vi='vim --noplugin' 

#HTTP
#http_proxy=http://127.0.0.1:18118
#https_proxy=http://127.0.0.1:18118

# No Proxy
function noproxy
{
    #/usr/local/sbin/noproxy  #turn off proxy server
    unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY
}


# Proxy
function setproxy
{
	#export http_proxy=http://dev-proxy.oa.com:8080
	#export https_proxy=http://dev-proxy.oa.com:8080
    #sh /usr/local/sbin/proxyon  #turn on proxy server 
    http_proxy=http://127.0.0.1:18118
    HTTP_PROXY=$http_proxy
    https_proxy=$http_proxy
    HTTPS_PROXY=$https_proxy
    export http_proxy https_proxy  HTTP_PROXY HTTPS_PROXY
}

# Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x
export COCOS_CONSOLE_ROOT=/opt/cocos2d-x/tools/cocos2d-console/bin
export PATH=$COCOS_CONSOLE_ROOT:$PATH

# Add environment variable COCOS_TEMPLATES_ROOT for cocos2d-x
export COCOS_TEMPLATES_ROOT=/opt/cocos2d-x/templates
export PATH=$COCOS_TEMPLATES_ROOT:$PATH

# Add environment variable NDK_ROOT for cocos2d-x
export NDK_ROOT=/run/media/corvo/Sda/Android/Ndk/android-ndk-r10e
export PATH=$NDK_ROOT:$PATH

# Add environment variable ANDROID_SDK_ROOT for cocos2d-x
export ANDROID_SDK_ROOT=/run/media/corvo/Sda/Android/Sdk
export PATH=$ANDROID_SDK_ROOT:$PATH
export PATH=$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH

# Add environment variable ANT_ROOT for cocos2d-x
#export ANT_ROOT=/usr/bin
#export PATH=$ANT_ROOT:$PATH

# For Eclipse
export SWT_GTK3=0

# For Steam
export STEAM_RUNTIME=0

# For LESS to EDITOR
export EDITOR=vim

# go
export GOROOT=/usr/lib/go
export PATH=$PATH:$GOROOT/bin:/home/corvo/go/bin

# Spark
export SPARK_HOME=/opt/apache-spark
export PYTHONPATH=$SPARK_HOME/python/:$PYTHONPATH
export PYTHONPATH=$SPARK_HOME/python/lib/py4j-0.10.4-src.zip:$PYTHONPATH
export PYSPARK_PYTHON=python2  # spark 需要python2

date | cowsay -e \$\# | toilet -f term --gay  # | lolcat

# PATH=/opt/node/node-v6.11.3-linux-x64/bin:$PATH
# Auto getmail when terminal start
# getmail -r ~/.getmail/getmailrc.163 -v &

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

#alias for cnpm
alias cnpm="npm \
  --registry=https://registry.npm.taobao.org \
  --cache=$HOME/.npm/.cache/cnpm \
  --disturl=https://npm.taobao.org/dist \
  --userconfig=$HOME/.cnpmrc"

alias say='echo "$1" | espeak -s 120 2>/dev/null'
alias tnpm="tnpm --proxy=http://127.0.0.1:18118"

# For repo
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# export PATH="${PATH}:/opt/depot_tools"

#PATH="/run/media/corvo/Help/node_modules/bin:$PATH"
#export npm_config_prefix=/run/media/corvo/Help/node_modules

# android adb
# PATH="$PATH:/run/media/corvo/Work/Android/sdk/platform-tools"

# The next line updates PATH for the Google Cloud SDK.
if [ -f /run/media/corvo/Sda/XWared/google-cloud-sdk/path.zsh.inc ]; then
  source '/opt/google-cloud-sdk/path.zsh.inc'
fi

# The next line enables shell command completion for gcloud.
if [ -f /run/media/corvo/Sda/XWared/google-cloud-sdk/completion.zsh.inc ]; then
  source '/opt/google-cloud-sdk/completion.zsh.inc'
fi

# function proxy_on() {
#     export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
#     export http_proxy="http://127.0.0.1:8118/"
#     export https_proxy=$http_proxy
#     echo "Proxy environment variable set."
#     return 0
# }
# 
# function proxy_off(){
#     unset http_proxy
#     unset https_proxy
#     unset ftp_proxy
#     unset rsync_proxy
#     echo -e "Proxy environment variable removed."
# }

# added by travis gem
[ -f /home/corvo/.travis/travis.sh ] && source /home/corvo/.travis/travis.sh


set -o vi
